//
//  AllHotelCell.swift
//  DLuxTravel
//
//  Created by 陆涛 on 2018/11/22.
//  Copyright © 2018 imguider. All rights reserved.
//

import UIKit

class AllHotelCell: BaseCell {

    @IBOutlet weak var layerView: UIView!
    
    @IBOutlet weak var hotelImageView: UIImageView!
    @IBOutlet weak var hotelImageViewH: NSLayoutConstraint!
    
    override func awakeFromNib() {
        super.awakeFromNib()
        
        self.configCell(.container)
        
        layerView.layer.cornerRadius = 8
        layerView.addShadow(.hotel)
        
        
        let width = CGFloat(kScreenWidth - 40);
        let height = width * 152 / 335
        
        hotelImageViewH.constant = height
        
        let roundedRect = CGRect(x: 0, y: 0, width: width, height:height)
        let rounded = UIBezierPath(roundedRect: roundedRect, byRoundingCorners: [.topLeft,.topRight], cornerRadii: CGSize(width: 8, height: 8));

        let shape = CAShapeLayer()
        shape.path = rounded.cgPath

        hotelImageView.layer.mask = shape

    }
    
    class func cellHeight() ->CGFloat {
        
        return CGFloat(kScreenWidth - 40) * 152 / 335 + 98 + 20
    }
}
